package com.sx.wechat.command.api;

import com.sx.core.model.Information;
import com.sx.core.mybatis.SessionTemplate;
import com.sx.core.vo.JsonReaderResponse;
import com.sx.wechat.command.cmd.AbstractCommand;
import com.sx.wechat.security.AuthenticationHolder;
import com.sx.wechat.security.Principal;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * 挂失解挂
 * Created by lihao on 2018/3/21.
 */
@Component("get_user_info")
public class Get_user_info extends AbstractCommand {
    @Autowired
    SessionTemplate sessionTemplate;
    @Override
    public Object executeApi(HttpServletRequest request, HttpServletResponse response) {
        Principal principal= AuthenticationHolder.getCurrent();
        return new JsonReaderResponse().addExtra(sessionTemplate.get(Information.class,principal.getId()));
    }
}
